<?php
defined('DCS_ROOT') or exit(header("HTTP/1.1 430 Not Forbidden"));

class coming {
	
	function __construct() {
		$this->defaultAction();
		exit();
	}

	function defaultAction(){		
		$tpl = new Template("movie/coming.htm" );
		$db  = getDB();
		$url = getUrl();

		if($url['params']['1'] == 'page'){
			$pagetemp = $url['params']['2'];		
		}

		$time = time();
		$yeartime = mktime(0,0,0,date("m")+6,date("d"),  date("Y"));		

		$param['table'] = 'movie ';
		$param['field'] = ' * ';
		$param['where'] = " playtime >= '$time' AND endtime <= '$yeartime' ";
		$param['order'] = ' playtime ';
		$param['page']= is_numeric($pagetemp) ? $pagetemp :'1';		
		$param['rows'] = '20';
		$param['pageUrl'] = '/movie/coming/page/';
		$param['pageTotal']	= $db->getTotal($param);		
		$play_movie = $db->getList($param);

		if(!empty($play_movie)){
			foreach($play_movie as $k=>$v){
				$play_movie[$k]['k'] = $k + 1;
				$play_movie[$k]['playtime'] = date('Y-m-d',$v['playtime']);				
			}
		}
		//de($play_movie);
		$tpl->assign("play_movie", $play_movie);
		$tpl->assign("pages", makePage($param));
		$tpl->assign(assignUser());
		$tpl->assign("debuginfo",debuginfo().$db->getQueryTimes().' 次查询');
		$tpl->output();

	}


}

?>
